package com.fish.design.create.singleton.lazy;

/**
 * @PACKAGE_NAME: com.fish.design.create.singleton.lazy
 * @Author: wangyingbin
 * @Date: 2021/11/8 19:09
 * @Description: 双锁单例
 */

public class LazyDoubleCheckSingleton {
    private LazyDoubleCheckSingleton(){}
    private volatile static LazyDoubleCheckSingleton INSTANCE = null;
    public static LazyDoubleCheckSingleton getInstance(){
        if(INSTANCE ==null){
            synchronized (LazyDoubleCheckSingleton.class){
                if(INSTANCE == null){
                    INSTANCE = new LazyDoubleCheckSingleton();
                }
            }
        }
        return INSTANCE;
    }
}
